<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>

<input type="button" value="不含参的函数" onclick="fun1()">
<input type="button" value="含参的函数" onclick="fun2('刘天勇',20)">
<input type="button" value="页面加载问题">

<script type="text/javascript">

    function fun1() {
        alert("这里是不含参数的！");
    }

    function fun2(name,age) {
        alert(name + "," + age)
    }

    // function fun3() {
    //     var btn = document.getElementsByTagName("input")[2];
    //     function fun4() {
    //         alert("hello！")
    //     }
    //     btn.onclick = fun4;
    // }

    // window.onload = function () {
    //     var bth = document.getElementsByTagName("input")[2];
    //     function func4() {
    //         alert("hello");
    //     }
    //     bth.onclick = func4;
    // };

    /*匿名函数*/
    window.onload = function () {
        var btn = document.getElementsByTagName("input")[2];
        window.alert("hello");
    }
</script>
</body>
</html>